﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="link.aspx.cs" Inherits="WebSite.admin.link.link" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>友情链接</title>
    <link href="../main.css" rel="stylesheet" type="text/css" />
	<script language="javascript">
	    parent.maintitle.innerHTML = "友情链接";
	    parent.contentmain.innerHTML = "<span class='title01'>备注：</span>友情链接管理。&nbsp;&nbsp;<img src='images/sort_desc.gif' /> <a href='link/addlink.aspx' target=content><font color=#ff0000>添加友情链接</font></a>"
    </script>
    <script type="text/javascript" language="javascript">
        function CheckSelect(del, str) {
            var rt = true;
            var num = 0;
            var boxorder = 0;
            var objCheckBox;
            for (var i = 0; i < form1.length; i++) {
                ///alert(form1.elements[i].type);
                if (form1.elements[i].type == "checkbox") {
                    boxorder++;
                    objCheckBox = form1.elements[i];
                    ///alert(objCheckBox.checked);
                    if (objCheckBox.checked) {
                        if (boxorder > 1) {
                            //如果是第一个CheckBox，是用来全选全消的，这个不算，不用自加
                            num++;
                        }
                    }
                }
            }
            ///alert(num);
            if (!del) {
                if (num > 1) {
                    alert("此操作不允许选择多个事件");
                    rt = false;
                }
            }
            if (str == 'del') {
                if (num == 0) {
                    alert("你没有选择要删除的信息");
                    rt = false
                } else { return confirm('你确定要删除这些信息吗?'); }
                ///alert(rt);
            }
            else {
                if (str == 'update') {
                    if (num == 0) {
                        alert("你没有选择要更新的信息");
                        rt = false
                    } else { return confirm('你确定要更新这些信息吗?'); }
                    ///alert(rt);
                } 
            }
            return rt;
        }

        function SelectAll(sa) {
            ///全选/全消
            var objCheckBox;
            for (var i = 0; i < form1.length; i++) {
                if (form1.elements[i].type == "checkbox") {
                    objCheckBox = form1.elements[i];
                    objCheckBox.checked = sa;
                }
            }
        }
</script>
</head>
<body bgcolor="#F1F4F7">
    <form id="form1" runat="server">
    <div><uc50:controlre ID="controlre_1" runat="server" />
    <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F1F4F7">
        <tr>
          <td align="center" valign="top" bgcolor="#F1F4F7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="2%" height="33" background="../images/info-list-bg.gif">&nbsp;</td>
              <td width="98%" align="left" background="../images/info-list-bg.gif">
                  所在位置：友情链接管理
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="title01">搜索：</span> 关键字：<asp:TextBox ID="keyname" runat="server"></asp:TextBox> <asp:Button ID="Button3" runat="server" Text="查询" OnClick="Button3_Click" /></td>
            </tr>
          </table>
		 
		 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting" DataKeyNames="linkid" AllowPaging=True OnPageIndexChanging="GridView1_PageIndexChanging" Width="98%" BorderWidth="0px" OnRowDataBound="GridView1_RowDataBound">
           <Columns>                
             <asp:TemplateField ShowHeader="False" HeaderText="选择">
                 <ItemStyle Width="60px" Wrap="False" />
                 <HeaderTemplate>
                     <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
                 </HeaderTemplate>
                 <ItemTemplate>
                     <asp:CheckBox ID="CheckBox1" runat="server"></asp:CheckBox>
                 </ItemTemplate>
             </asp:TemplateField>
                <asp:HyperLinkField DataNavigateUrlFields="linkid" DataNavigateUrlFormatString="addlink.aspx?lid={0}" HeaderText="名称" DataTextField="linkname" />
                 <asp:BoundField DataField="linkurl" HeaderText="网址" />
                 <asp:TemplateField ShowHeader="False" HeaderText="排序">
                 <ItemTemplate>
                     <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("linkorder") %>' Width="60px"></asp:TextBox>
                 </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="True" HeaderText="删除"  DeleteText="&lt;div id=&quot;de&quot; onclick=&quot;JavaScript:return confirm('你确定要删除?')&quot;&gt;删除&lt;/div&gt;" />               
                <asp:HyperLinkField DataNavigateUrlFields="linkid" DataNavigateUrlFormatString="addlink.aspx?lid={0}" HeaderText="查看" Text="查看" />
               
            </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="#FFFFFF" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="True" />
             <HeaderStyle BackColor="#ffffff" Font-Bold="True" ForeColor="#000000" />
             <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
		 
          <table width="98%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="40" align="center" valign="top"><asp:Button ID="Button2" runat="server" Text="更新所选" OnClick="Button2_Click" /><asp:Button ID="Button1" runat="server" Text="删除所选" OnClick="Button1_Click" /></td>
              </tr>
          </table></td>
        </tr>
      </table>
    </div>
    </form>
</body>
</html>
